home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / printing / ds2v4052.zip / FORPGMRS.EXE / lha / README.DOC < prev    next >
Text File  |  1993-03-08  |  17KB  |  421 lines

  1. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  2. ▌                                                                           ▐
  3. ▌ The Despooling Library         by Budget Software Company                 ▐
  4. ▌      v 1.02                       P.O. Box 621534                         ▐
  5. ▌                                   Littleton CO 80162                      ▐
  6. ▌                                   (303) 932-1705                          ▐
  7. ▌                                                                           ▐
  8. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  9.  
  10.  
  11. =========================================================================
  12.  
  13.  
  14. Introduction
  15. ------------
  16.  
  17. The Despooling Library features three levels of functionality:
  18.  
  19.  - You can use DSP.OBJ by itself, in which case you've got a mechanism for
  20.    sending output to your LPT and COM ports.  You must supply all of the
  21.    interrupt handling.  All DSP does is allow you to send it a byte, or
  22.    a pointer to a byte stream, and indicate the printing port.
  23.  
  24.    The program TDSP.CPP is included as a demonstration of DSP.OBJ's
  25.    functionality.
  26.  
  27.  - In addition to using DSP.OBJ, you can also utilize the two DSPCTL modules:
  28.    DSPCTL1.OBJ and DSPCTL2.OBJ.  (The reason that the DSPCTL function is
  29.    separated into two OBJ's is that you can discard DSPCTL2.OBJ after
  30.    initialization is complete, if you want.)  DSPCTLx controls the despooling
  31.    activity at a higher level.  First of all, it hooks several interrupts.
  32.    (You decide which ones you want to have it hook: 8, 16, b, c, and/or f.)
  33.    Secondly, you can pass as long a stream as you wish to it (up to 64k),
  34.    and it will perform the background printing using the interrupts you
  35.    told it to use.  When it has finished the stream, it will inform you
  36.    by calling a routine (indirect far pointer) that you have designated.
  37.    The port associated with the stream is indicated to you, so that all
  38.    you have to do in your "calledback" routine is fetch some more data, and
  39.    issue another print request for the port.
  40.  
  41.    All 8 ports can be managed asynchronously.  Just send each port a request
  42.    to print, and you'll have multiple printers printing in the background,
  43.    and at the same time!
  44.  
  45.    The program TDSPCTL.ASM is included as a demonstration of DSPCTLx.OBJ's
  46.    functionality.
  47.  
  48.  - In addition to the above two modules, you can optionally include modules
  49.    DSPFIL.OBJ and DSPFIL2.OBJ.  These two modules work exactly like the DSPCTLx
  50.    modules described above, except that they allow you to designate a disk
  51.    file to be printed, rather than simply a memory buffer.  When the file
  52.    is all printed, a "callback" is made (optionally) to your designated
  53.    routine.  (Note: you must also include modules BACKGRDM.OBJ and BACKGRM2.OBJ,
  54.    as well as MSGQUE.OBJ and MSGQUE2.OBJ.)
  55.  
  56.    The program TDSPF.ASM is included as a demonstration of DSPDILx.OBJ's
  57.    functionality.
  58.  
  59. ==============================================================================
  60.  
  61.  
  62. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  63. ▌ DSP.OBJ          ▐
  64. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  65.  
  66. Features
  67. --------
  68.  
  69. -  Supports all 4 COM and all 4 LPT ports.
  70.  
  71. -  Dynamically adjustes "wait time" for printer.
  72.  
  73. -  Supports simultaneous printing of all 8 ports.
  74.  
  75. -  Supports both printing directly to port as well as utilizing the BIOS.
  76.  
  77. -  You can indicate how many are to be printed at each INT8 for each port;
  78.    and you can indicate a maximum time slice in 10,000ths of a second, as well.
  79.  
  80.  
  81. Instructions for use
  82. --------------------
  83.  
  84. There are two functions:
  85.  
  86.      _dspler_init_me - Initializes DSP.  Must be called at least once
  87.                        before calling function _dspler_despool.  You may
  88.                        call this routine again if you wish to change the
  89.                        despooling method (direct vs. BIOS) for a port.
  90.  
  91.      _dspler_despool - Sends byte(s) to the printer.
  92.  
  93.  
  94. ┌──────────────────┐
  95. │ _dspler_init_me  │
  96. └──────────────────┘
  97.  
  98. ENTRY:  AL - 8 bits, one for each port; biton means to use the BIOS
  99.              method of Despooling.  bit 7 = COM1; bit 6 = COM2 ... bit 3 = LPT1,
  100.              and so forth.
  101.         AH - 8 bits, one for each port; biton means to use the direct
  102.              method of Despooling.  The meaning of the bits is the same as
  103.              with AL, above.
  104.  
  105.         DX - The maximum amount of time (in 10,000ths of a second units)
  106.              that should be spent in an INT8.
  107.  
  108.        (Note: The reason I didn't simply use AL as a binary condition, biton =
  109.         use BIOS, and bitoff = go direct to port, is that I am planning for
  110.         a third method of despooling; namely, output using DOS.  There is
  111.         a complication using this method in that you can only perform output
  112.         using DOS when it's "safe", re-entry wise.  Despooling via DOS is
  113.         rarely needed, so for now, I am not including it in the code.)
  114.  
  115. ┌──────────────────┐
  116. │ _dspler_despool  │
  117. └──────────────────┘
  118.  
  119. ENTRY:  CL - number of bytes to send.
  120.              (Note: If you are coming off of an IRQ, or off of Idle time (int16),
  121.                     then you should always set CL to 1.  This is because
  122.                     there is nothing to gain trying to send multiple bytes
  123.                     from these sources.  The next IRQ will almost certainly
  124.                     occur before the printer is ready; and as for Idle time,
  125.                     you should be looping within INT 16h until a byte is
  126.                     ready at the keyboard buffer; and so again, the next
  127.                     call into this routine will certainly happen before
  128.                     the printer is ready.)
  129.         BL - Port
  130.                 0=COM1
  131.                 1=COM2
  132.                 2=COM3
  133.                 3=COM4
  134.                 4=LPT1
  135.                 5=LPT2
  136.                 6=LPT3
  137.                 7=LPT4
  138.         BH - Source of print request
  139.                 0 - IRQ
  140.                 1 - Idle
  141.                 2 - Timer interrupt
  142.              (Note: The reason for this parameter is so the program can
  143.                     perform "retry" action if it is in the Timer interrupt.
  144.                     Retry action is when the system delays a bit waiting
  145.                     for the printer to finish processing a byte.  It doesn't
  146.                     make any sense to perform retry action from IRQ or
  147.                     from Idle, since by definition, these sources of print
  148.                     requests are occurring continuously, anyway.)
  149.         CH -    If CL = 1, then CH contains the byte to print.
  150.         DX:AX - If CL is greater than 1, then DX:AX should point to the
  151.                 stream of characters.
  152. RETURN: AH = 0 means that the function terminated normally, in which case
  153.         AL returns the number of bytes actually printed.  (Note: just because
  154.         the function terminated normally doesn't mean any bytes were actually
  155.         printed.  Maybe the printer is offline.)
  156.  
  157.         AH not = 0 means that an error occured.  Most likely you sent
  158.         an invalid input parameter.
  159.  
  160.  
  161. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  162. ▌ DSPCTLx.OBJ      ▐
  163. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  164.  
  165. Features
  166. --------
  167.  
  168. - Utilizes DSP.OBJ to provide complete asynchonous background printing to
  169.   up to 8 ports simultaneously.
  170.  
  171. - Hooks the "background" interrupts.
  172.  
  173. - Allows you to designate which of the "background" interrupts you wish
  174.   to utilize (8, 16, b, c, and/or f).
  175.  
  176. Instructions for use
  177. --------------------
  178.  
  179. There are two functions:
  180.  
  181.      _dspctl_init_me       - Initializes DSPCTLx.  Must be called once, and
  182.                              only once, before calling function
  183.                              _dspctl_request print.
  184.  
  185.      _dspctl_request_print - Issue a print request.
  186.  
  187.  
  188. ┌──────────────────┐
  189. │ _dspctl_init_me  │
  190. └──────────────────┘
  191.  
  192.  
  193. (NOTE: _dspctl_init_me takes care of calling _dspler_init_me for you.)
  194.  
  195.  
  196. ENTRY - DX:AX points to a structure that looks like this:
  197.        offset type   description
  198.        ------ ----   -----------------------------------------------------
  199.         0      dd    original int 8 vector; if left 0, I won't hook int8
  200.         4      dd    original int 16 vector; if left 0, I won't hook int16
  201.         8      dd    original int b vector; if left 0, etc.
  202.         c      dd    original int c vector; etc.
  203.     10h    dd    original int f vector; etc.
  204.         14h    dd    far ptr to routine you want me to call whenever
  205.                      I need to tell you that I've finished a stream, and
  206.                      am ready for more.
  207.  
  208.                      BL will contain 0 - com1 needs more
  209.                                      1 - com2 needs more
  210.                                      2 - com3 needs more
  211.                                      3 - com4 needs more
  212.                                      4 - lpt1 needs more
  213.                                      5 - lpt2 needs more
  214.                                      6 - lpt3 needs more
  215.                                      7 - lpt4 needs more
  216.  
  217.         18h    dw    # bytes/timer tick...com1
  218.     1Ah    dw    # bytes/timer tick...com2
  219.         1Ch    dw    # bytes/timer tick...com3
  220.         1Eh    dw    # bytes/timer tick...com4
  221.         20h    dw    # bytes/timer tick...lpt1
  222.         22h    dw    # bytes/timer tick...lpt2
  223.         24h    dw    # bytes/timer tick...lpt3
  224.         26h    dw    # bytes/timer tick...lpt4
  225.         28h    db    com port number for intb; 1=com1, 2=com2, etc.
  226.         29h    db    com port number for intc; 1=com1, 2=com2, etc.
  227.         2Ah    db    8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc.
  228.                      Use Bios for output.
  229.         2Bh    db    8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc.
  230.                      Output direct.
  231.         2Ch    dw    Maximum amount of time (in 10,000ths of a second units)
  232.                      to spend within INT8.
  233.  RETURN - none
  234.  
  235.  
  236. ┌────────────────────────┐
  237. │ _dspctl_request_print  │
  238. └────────────────────────┘
  239.  
  240.  INPUT: DX:AX is a pointer to a stream of data
  241.            CX is the number of bytes in the stream
  242.            BH indicates port, as follows:
  243.                bit 7->COM1
  244.                bit 6->COM2
  245.                bit 5->COM3
  246.                bit 4->COM4
  247.                bit 3->LPT1
  248.                bit 2->LPT2
  249.                bit 1->LPT3
  250.                bit 0->LPT4
  251.          Note how in this manner, you can send a stream to multiple
  252.          printers in one shot.  Believe it or not, I've had a person
  253.          request this feature.  It's really not that unusual,
  254.          since this is a good way to produce multiple copies. This won't
  255.          work for large documents, since depending on the speed of the
  256.          printers, one printer will surely finish the stream before the other;
  257.          and it would be wasteful to have to fast printer wait around for
  258.          the slow one to catch up.
  259.  RETURN: AL not 0 -> problem, and furthermore, the bits of AL
  260.          indicate ports that couldn't accept the request, since
  261.          such port is currently handling a prior request.  The bits of AL are
  262.          defined in the same manner as BH, above.
  263.  
  264. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  265. ▌ DSPFILx.OBJ      ▐
  266. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  267.  
  268. Features
  269. --------
  270.  
  271. - Utilizes DSP.OBJ and DSPCTL.OBJ to provide complete asynchonous background
  272.   printing to up to 8 ports simultaneously.
  273.  
  274. - Prints an entire DOS file.
  275.  
  276. - Two methods of file submittals:
  277.  
  278.   - Internal far call.
  279.   - Using an INT 1A.
  280.  
  281.  
  282. Instructions for use
  283. --------------------
  284.  
  285. There are two functions:
  286.  
  287.      _dspfil_init_me       - Initializes DSPFILx.  Must be called once, and
  288.                              only once, before calling function
  289.                              _dspfil_request print.
  290.  
  291.  
  292.      _dspfil_request_print - Issues a print request.
  293.  
  294.  
  295.  
  296. There is also a way to issue a print request via an INT 1Ah (see below).
  297.  
  298.  
  299. ┌──────────────────┐
  300. │ _dspfil_init_me  │
  301. └──────────────────┘
  302.  
  303. (NOTE: _dspfil_init_me takes care of calling _dspctl_init_me for you.)
  304.  
  305.  
  306. INPUT - DX:AX points to a structure that looks like this:
  307.        offset type   description
  308.        ------ ----   -----------------------------------------------------
  309.         0      dd    original int 8 vector; if left 0, I won't hook int8
  310.         4      dd    original int 16 vector; if left 0, I won't hook int16
  311.         8      dd    original int b vector; if left 0, etc.
  312.         c      dd    original int c vector; etc.
  313.         10h    dd    original int f vector; etc.
  314.         14h    dd    far ptr to routine you want me to call whenever
  315.                      I need to tell you something ... usually to inform
  316.                      you that I've printed the file and am ready for more.
  317.                      BL will contain 0 - com1 done
  318.                                      1 - com2 done
  319.                                      2 - com3 done                          ▒
  320.                                      3 - com4 done                          ▒
  321.                                      4 - lpt1 done                          ▒
  322.                                      5 - lpt2 done                          ▒
  323.                                      6 - lpt3 done                          ■
  324.                                      7 - lpt4 done                          ▒
  325.                     DX:AX will point to file just printed                   ▒
  326.         18h    dw    # bytes/timer tick...com1                              ▒
  327.         1Ah    dw    # bytes/timer tick...com2                              ▒
  328.         1Ch    dw    # bytes/timer tick...com3                              ▒
  329.         1Eh    dw    # bytes/timer tick...com4                              ▒
  330.         20h    dw    # bytes/timer tick...lpt1                              ▒
  331.         22h    dw    # bytes/timer tick...lpt2                              ▒
  332.         24h    dw    # bytes/timer tick...lpt3                              ▒
  333.         26h    dw    # bytes/timer tick...lpt4                              ▒
  334.         28h    db    com port number for intb 1=com1, 2=com2, etc.          ▒
  335.         29h    db    com port number for intc                               ▒
  336.         2Ah    db    8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc.    ▒
  337.                      Use Bios for output.                                   
  338.         2Bh    db    8 bits. bit 7=com1, bit 6=com2 ... bit 3=lpt1, etc.    ■
  339.                      Output direct.                                         ▒
  340.         2Ch    dw    max number of 10,000ths of a second I should spend in  ▒
  341.                      int8.                                                  ▒
  342.  RETURN - none                                                              ▒
  343.  
  344.  
  345. ┌────────────────────────┐
  346. │ _dspfil_request_print  │
  347. └────────────────────────┘
  348.  
  349. INPUT   -  DX:AX points to an ASCIIZ
  350.            BH indicates port, as follows:
  351.                bit 7->COM1
  352.                bit 6->COM2
  353.                bit 5->COM3
  354.                bit 4->COM4
  355.                bit 3->LPT1
  356.                bit 2->LPT2
  357.                bit 1->LPT3
  358.                bit 0->LPT4
  359.   CL='n'->don't bother calling back when done.
  360.  
  361. RETURN: AL not 0 -> problem, and furthermore, the bits of AL
  362.          indicate ports that couldn't accept the request, since
  363.          such port already is doing a file.  The bits of AL are
  364.          defined in the same manner as BH, above.
  365.  
  366.  
  367. ┌─────────────────────────────┐
  368. │ Print request using INT 1ah │
  369. └─────────────────────────────┘
  370.  
  371.      ∙ AH = 0e4h
  372.      ∙ AL = 1 (don't notify me when finished)
  373.           = 2 (do notify me when finished)
  374.      ∙ ES:BX points to file ASCIIZ.
  375.      ∙ CL - designates port:
  376.           1 = COM1
  377.           2 = COM2
  378.           3 = COM3
  379.           4 = COM4
  380.           5 = LPT1
  381.           6 = LPT2
  382.           7 = LPT3
  383.           8 = LPT4
  384.  
  385. On Return, AH=0 -> Okay
  386.  
  387. ===============================================================================
  388.  
  389. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  390. ▌ REVISION LOG     ▐
  391. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  392.  
  393. Version 1.01
  394. ------------
  395.  
  396. -- A bug existed whereby data was being despooled incorrectly.  This has
  397.    been fixed in this version.  Specifically, if timer-interrupt despooling
  398.    was taking place, then on certain rare occasions (whenever the number
  399.    of bytes left to print in the buffer was exactly 1), a byte of 0h would
  400.    be despooled, rather than the correct byte.
  401.  
  402. -- In DSPCTL1 in my INT8 hook, I now do an INT 1ah (with AH = 6eh).  If
  403.    you are doing your own INT 8 hooks, you may want to try hooking this
  404.    INT 1ah instead.  I will have already called the previous int 8, so you
  405.    don't have to worry about doing an EOI.  You should put a re-entrancy
  406.    bypass into your routine, however.
  407.  
  408. ------------------------------------
  409.  
  410. Version 1.02
  411. ------------
  412.  
  413. -- A minor bug existed in the computation of the amount of time to remain
  414.    inside of an int8 print request.  This has been fixed.
  415.  
  416. -- I no longer require that the user turn on and turn off the irq's
  417.    insofar as COM ports are concerned.  I do it myself at the
  418.    appropriate time.
  419.  
  420.  
  421.